<?php

namespace app\api\validate;


use \think\Validate;

/**
 *  订单验证类
 */
class Logistics extends Validate
{
    protected $rule = [
        'user_id'=> 'require|number',
        'product' => 'require|array',
        'address_id' => 'require|number',
        'shipping_method_id' => 'require|number',
        'is_wholesal' => 'require|number|in:1,2',
        'payment_method_id' => 'require|number',
        'billing_address' => 'require|number',
        'billing_address_id' => 'require|number',
    ];

    //定义验证提示
    protected $message = [
        'user_id.require' => 'logistics.userIdRequire',
        'user_id.number' => 'logistics.userIdNumber',
        'product.require' => 'logistics.idsRequire',
        'product.array' => 'logistics.idsArray',
        'address_id.require' => 'logistics.addressIdRequire',
        'address_id.number' => 'logistics.addressIdNumber',
        'shipping_method_id.require' => 'logistics.shippingMethodIdRequire',
        'shipping_method_id.number' => 'logistics.shippingMethodIdNumber'
    ];

    //定义验证场景
    protected $scene = [
        'cart' => [ 'product','address_id'],
        'order' => ['user_id', 'product','address_id']
    ];

}
